<?php

namespace Frieza\Modules\Position\Actions;

use Doraemon\cache\PositionModule\ApiCounter;
use Encore\Admin\Actions\RowAction;

class ClearOnceCache extends RowAction
{
    public $name = '清除有效期内加载';

    public function dialog()
    {
        $this->confirm('确定删除缓存');
    }

    public function getHandleRoute()
    {
        $parameters = [
            'api' => $this->getRow()->api,
            'uid' => $this->getRow()->uid,
            'action' => ApiCounter::SIGN_TYPE_ONCE,
        ];
        return admin_url('/position/admIndex/clearPositionCache?' . http_build_query($parameters));
    }
}